package cn.zmit.kuxi.adapter;

import android.annotation.SuppressLint;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import cn.zmit.kuxi.R;
import cn.zmit.kuxi.activity.binner.SliderBanner;
import cn.zmit.kuxi.activity.binner.SliderBannerController;
import cn.zmit.kuxi.contants.Url;

import com.nostra13.universalimageloader.core.ImageLoader;
import com.xdroid.functions.request.JsonData;

/**
 * 商品详情视图顶部 图片展示
 * @author Robin
 * time 2015-04-21 17:11:58
 */
public class ProductDetailsSliderBanner extends SliderBannerController {
	public ProductDetailsSliderBanner(SliderBanner sliderBanner) {
		super(sliderBanner);
	}

	@SuppressLint("InflateParams")
	@Override
	public View createView(LayoutInflater layoutInflater, final int position,
			final JsonData itemData) {
	    View convertView = layoutInflater.inflate(R.layout.view_slider_banner_item, null);
        ImageView imageView = (ImageView) convertView.findViewById(R.id.img_banner_item);
        imageView.setAdjustViewBounds(false);
        imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);

        String pic = itemData.optString("pictures");  //获取图片地址
        ImageLoader.getInstance().displayImage(Url.IMAGE_PICTURES+ pic,imageView);//加载图片
        
        convertView.setTag(itemData);
        convertView.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
			}
		});
		return convertView;
	}
}
